//
//  BPUIToolNavigationView.m
//  BPUIKit_Example
//
//  Created by 404 on 2020/7/30.
//  Copyright © 2020 404. All rights reserved.
//

#import "BPUIToolNavigationView.h"

@implementation BPUIToolNavigationView

- (void)didInitialize {
    [super didInitialize];
    self.backgroundColor = [UIColor clearColor];
    self.shadow.hidden = YES;
    self.titleLabel.hidden = YES;
    self.backgroundView.backgroundColor = [UIColor clearColor];
    
    [self.backgroundView addSubview:self.toolView];
    self.toolView.top = 10;
    self.left = SCREEN_WIDTH - self.toolView.width - 10;
    
    [self.backgroundView addSubview:self.moreButton];
    self.moreButton.left = self.toolView.left + 5;
    self.moreButton.centerY = self.toolView.centerY;
    
    [self.backgroundView addSubview:self.closeButton];
    self.closeButton.left =  self.toolView.width - self.closeButton.width - 5;
    self.closeButton.centerY = self.toolView.centerY;
    
    [self.backgroundView addSubview:self.lineView];
    self.lineView.centerX = self.toolView.centerX;
    self.lineView.centerY = self.moreButton.centerY;
}

- (UIView *)toolView{
    if (!_toolView) {
        _toolView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 80, 30)];
        _toolView.backgroundColor = [UIColor blackColor];
        _toolView.alpha = .3;
        _toolView.layer.cornerRadius = 14;
        _toolView.layer.masksToBounds = YES;
    }
    return _toolView;
}

- (UIButton *)moreButton{
    if (!_moreButton) {
        _moreButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
        [_moreButton setImage:UIImageMake(@"nav_tool_more") forState:UIControlStateNormal];
    }
    return _moreButton;
}

- (UIButton *)closeButton{
    if (!_closeButton) {
        _closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
        [_closeButton setImage:UIImageMake(@"nav_tool_close") forState:UIControlStateNormal];
    }
    return _closeButton;
}

- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, .5, 20)];
        _lineView.backgroundColor = [UIColor whiteColor];
        _lineView.alpha = .5;
    }
    return _lineView;
}

@end
